﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace GameVer1
{
    public class GameMenu
    {
        private Menu[] _AllMenuItem;
        public SoundEffect soundEffect;
        public Menu[] AllMenuItem
        {
            get { return _AllMenuItem; }
            set { _AllMenuItem = value; }
        }
        int i;
        public GameMenu()
        {

        }
        public GameMenu(Texture2D[] MenuTexture)
        {
            AllMenuItem = new Menu[5];
            i = 0;
            AllMenuItem[0] = new Menu(MenuTexture, 400, 0);
            AllMenuItem[0].soundEffect = soundEffect;
            AllMenuItem[1] = new Menu(MenuTexture, 360, 5);
            AllMenuItem[1].soundEffect = soundEffect;
            AllMenuItem[2] = new Menu(MenuTexture, 320, 1);
            AllMenuItem[2].soundEffect = soundEffect;
            AllMenuItem[3] = new Menu(MenuTexture, 280, 2);
            AllMenuItem[3].soundEffect = soundEffect;
            AllMenuItem[4] = new Menu(MenuTexture, 240, 3);
            AllMenuItem[4].soundEffect = soundEffect;
        }
        public void Draw(SpriteBatch spriteBatch)
        {
            for (int j =0; j < AllMenuItem.Length; j++)
            {
                AllMenuItem[j].Draw(spriteBatch,AllMenuItem[j].Scale);
            }
        }
        public void Update(GameTime gameTime,Game1 game1)
        {
            for (int j=0; j < AllMenuItem.Length;j++ )
            {
                if (j == i)
                {
                    AllMenuItem[j].Update(gameTime,game1);
                }
                if (i<AllMenuItem.Length && AllMenuItem[i].Y >= AllMenuItem[i].StopY)
                {
                    i++;
                }
            }
        }
    }
 
}
